5f730dc9ed7a80ad2de100940e051279c2018e1d,sonar-server/src/test/java/org/sonar/server/notifications/NotificationServiceTest.java,NotificationServiceTest,shouldPeriodicallyProcessQueue,#,40

Before Change


    service.start();

    NotificationQueue.Element element = mock(NotificationQueue.Element.class);
    when(queue.get()).thenReturn(element);
    Thread.sleep(50);

    verify(service, atLeastOnce()).deliver(element);

After Change


  @Test
  public void shouldPeriodicallyProcessQueue() throws Exception {
    NotificationQueueElement queueElement = mock(NotificationQueueElement.class);
    Notification notification = mock(Notification.class);
    when(queueElement.getNotification()).thenReturn(notification);
    when(manager.getFromQueue()).thenReturn(queueElement).thenReturn(null);
    doNothing().when(service).deliver(any(Notification.class));